# 导包
import time
import unittest
import HTMLTestRunner_PY3
from app import BASE_DIR
from script.test_employee import Test_Emp
from script.test_employee_params import Test_Emp_Params
from script.test_login import Test_Login
from script.test_login_params import Test_Login_Params


"""
生成报告 - 合并写法
包含时间命名（之前的报告不会被覆盖）
"""
# 实例化测试套件
suite = unittest.TestSuite()
# 向测试套件内添加测试用例
suite.addTest(unittest.makeSuite(Test_Login_Params))
suite.addTest(unittest.makeSuite(Test_Emp_Params))
# 生成报告
report_name = BASE_DIR + f"/report/iHRM {time.strftime('%Y%m%d %H%M%S')}.html"
with open(report_name,mode="wb") as f:
    # 实例化runner
    runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
    # 使用runner运行测试套件生成报告
    runner.run(suite)






"""
1.登录模块生成报告
"""
# # 创建测试套件
# suite = unittest.TestSuite()
# # 将测试用例添加到套件中
# suite.addTest(unittest.makeSuite(Test_Login))
# # 使用HTMLTestRunner生成测试报告
# with open(BASE_DIR+"/report/iHRM_Login_report.html",mode="wb") as f:
#     # 实例化runner
#     runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
#     # 用runner运行测试套件
#     runner.run(suite)





"""
2.员工管理模块生成报告
"""
# # 创建测试套件
# suite = unittest.TestSuite()
# # 将测试用例添加到套件中
# suite.addTest(unittest.makeSuite(Test_Emp))
# # 使用HTMLTestRunner生成测试报告
# with open(BASE_DIR+"/report/iHRM_Emp_report01.html",mode="wb") as f:
#     # 实例化runner
#     runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
#     # 用runner运行测试套件
#     runner.run(suite)





"""
登录模块 - 参数化
"""
# # 创建测试套件
# suite = unittest.TestSuite()
# # 将测试用例添加到套件中
# suite.addTest(unittest.makeSuite(Test_Login_Params))
# # 使用HTMLTestRunner生成测试报告
# with open(BASE_DIR+"/report/iHRM_Login_Params_report.html",mode="wb") as f:
#     # 实例化runner
#     runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
#     # 用runner运行测试套件
#     runner.run(suite)







"""
员工管理模块 - 参数化
"""
# # 创建测试套件
# suite = unittest.TestSuite()
# # 将测试用例添加到套件中
# suite.addTest(unittest.makeSuite(Test_Emp_Params))
# # 使用HTMLTestRunner生成测试报告
# with open(BASE_DIR+"/report/iHRM_Emp_Params_report.html",mode="wb") as f:
#     # 实例化runner
#     runner = HTMLTestRunner_PY3.HTMLTestRunner(f)
#     # 用runner运行测试套件
#     runner.run(suite)



a = 10